package com.lihuinch.ti4j.chap5.practice;

/**
 * 练习
 *
 * @author lihu
 * @date 2018/1/9
 */
public class Practise {
    public static void main(String[] args) throws Throwable {
        HasFinalize hasFinalize = new HasFinalize();
        hasFinalize.finalize();
        System.gc();
    }
}

/**
 * 有finalize方法测试 P89 例10
 *
 * @author lihu
 * @date 2018/1/9
 */
class HasFinalize {
    private int anInt;

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
        System.out.println("finalize()");
        System.out.println(this.getClass().getName() + " finalize()");
    }

    public int getAnInt() {
        return anInt;
    }

    public void setAnInt(int anInt) {
        this.anInt = anInt;
    }
}